package com.pantuo.sys.controller;

import com.pantuo.common.utils.TableRequest;
import com.pantuo.common.vo.JsonResult;
import com.pantuo.sys.service.VehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/vehicle")
public class VehicleController {

    @Autowired
    private VehicleService vehicleService;

    @RequestMapping("/doFindPageObjects")
    public PageImpl<Map<String, Object>> doFindPageObjects(TableRequest request) {
        System.out.println(request);
        String str = "hello";
        return vehicleService.findPageObjects(request);
    }


    @RequestMapping("/doFindAllNames")
    public JsonResult doFindAllNames(Integer id) {
        return new JsonResult(vehicleService.findAllNames(id));
    }


    @RequestMapping("/doFindIdAndCNameByNum")
    public JsonResult doFindIdAndCNameByNum(String vehicleNum2_s) {
        return new JsonResult(vehicleService.findIdAndCNameByNum(vehicleNum2_s));
    }


    //根据线路id查出车辆数量
    @RequestMapping("/doFindTotalByVId")
    public JsonResult findTotalByVId(Integer id) {
        return new JsonResult(vehicleService.findTotalByVId(id));
    }

    @RequestMapping("/doVehRangeSelect")
    public JsonResult doVehRangeSelect(TableRequest request) {
        return new JsonResult(vehicleService.vehRangeSelect(request));
    }
}

